﻿using System;
using System.Configuration;
using System.Web.Mvc;
using Elmah;

namespace Charades.Web.Helpers
{
	public class GlobalActionFilter : ActionFilterAttribute
	{
		public override void OnActionExecuting(ActionExecutingContext context)
		{
			base.OnActionExecuting(context);

			var url = context.RequestContext.HttpContext.Request.Url;
			if (url != null && url.Host == "api.drawpi.co")
			{
				context.Result = new RedirectResult(ConfigurationManager.AppSettings["RootUrl"]);
			}
		}
	}
}